import request from '@/utils/request'

// 获取所有企业
export const getEnterpriseList = (params) => {
  return request({
    url: '/park/enterprise',
    method: 'get',
    params
  })
}

// 获取所有行业
export const getIndustryList = () => {
  return request({
    url: '/park/industry',
    method: 'get'
  })
}

// 添加企业
export const addEnterprise = (data) => {
  return request({
    url: '/park/enterprise',
    method: 'post',
    data
  })
}

// 上传合同
export function uploadAPI(data) {
  return request({
    url: '/upload',
    method: 'POST',
    data
  })
}

// 企业信息回显
export const getEnterpriseInfo = (id) => {
  return request({
    url: `/park/enterprise/${id}`,
    method: 'get'
  })
}

// 修改企业信息
export const updateEnterprise = (data) => {
  return request({
    url: '/park/enterprise',
    method: 'put',
    data
  })
}

// 删除企业
export const deleteEnterprise = (id) => {
  return request({
    url: `/park/enterprise/${id}`,
    method: 'delete'
  })
}

// 获取楼宇列表
export const getBuildingList = (params) => {
  return request({
    url: '/park/building',
    method: 'get',
    params
  })
}

// 添加合同
export const addRentContract = (data) => {
  return request({
    url: '/park/enterprise/rent',
    method: 'post',
    data
  })
}

// 获取当前企业合同列表
export const getRentContractList = (id) => {
  return request({
    url: `/park/enterprise/rent/${id}`,
    method: 'get'

  })
}

// 退租         <!-- 合同id -->
export function outRentAPI(rentId) {
  return request({
    url: `/park/enterprise/rent/${rentId}`,
    method: 'PUT'
  })
}
